import oracledb
import requests
import json

response = requests.get('https://services.odata.org/V3/Northwind/Northwind.svc/Products/?$format=json')



oracledb.init_oracle_client(r"D:\Program\python\instantclient-basic-windows.x64-23.8.0.25.04\instantclient_23_8")
conn = oracledb.connect(user='system',password='123456',dsn="localhost:1521/orcl")
cursor = conn.cursor()
jsonObj = json.loads(response.text)
for data in jsonObj["value"]:
    print(data)
    cursor.execute("insert into yz_product values({},'{}','{}')".
                format(data['ProductID'],
                       data['ProductName'].replace("'","''"),
                       data['QuantityPerUnit'].replace("'", "''")))
conn.commit()
